package code._16reflect._06config;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;

public class Demo {
    public static void main(String[] args) throws IOException {
        //创建一个空属性列表
        Properties properties = new Properties();
        //从输入流读取属性列表
//        properties.load(new InputStreamReader(new FileInputStream("fileTest\\config.properties")));
        //按简单的面向行格式从输入字符流中读取属性列表（键和元素对）；
        //有中文时用这个
        properties.load(new InputStreamReader(new FileInputStream
                ("fileTest\\config.properties"),"UTF-8"));
        //用指定的键key搜索
        String username = properties.getProperty("username");
        System.out.println("username = " + username);
    }
}
